package csci4448.android.workouttracker;

import java.util.Locale;

public class SessionFactory {

	private SessionUnits _units;
	public SessionFactory()
	{
        String countryCode = Locale.getDefault().getCountry();
        _units = ("US".equals(countryCode) || "LR".equals(countryCode) || "MM".equals(countryCode)) ? SessionUnits.Imperial : SessionUnits.Metric;
	}
	public SessionFactory(SessionUnits Units)
	{
		_units = Units;
	}
	public Session createSession(int SessionID, long DurationSeconds, double DistanceMeters, String StartTime, String EndTime, String SessionName) throws Exception
	{
		if(_units == SessionUnits.Imperial)
		{
			return new ImperialSession(SessionID, DurationSeconds, DistanceMeters, StartTime, EndTime, SessionName);
		}
		else if(_units == SessionUnits.Metric)
		{
			throw new Exception("Not implemented");
		}
		else
		{
			throw new Exception("Not implemented"); 
		}
	}
}
